import numpy

#this matrix is to be read as: first column indicates the probability of 
#transitioning from the first state into the k'th state
A = numpy.arange(16*16).reshape(16,16) #transition from state j to state k

for e in A.flat:
    A.itemset(e,0)

A[0,0] = 1
A[1,0] = 1
A[2,0] = 1
A[3,0] = 1

A[4,1] = 1
A[4,2] = 1
A[4,3] = 1

A[5,4] = 1

A[6,5] = 1

A[7,6] = 1
A[8,7] = 1
A[9,8] = 1
A[6,8] = 1

A[10,9] = 1
A[11,9] = 1
A[12,9] = 1

A[13,10] = 1
A[14,11] = 1
A[15,12] = 1

A[0,13] = 1
A[0,14] = 1
A[0,15] = 1

print A

pi = numpy.arange(1*16).reshape(16, 1)


for e in pi.flat:
    pi.itemset(e,0)

pi.itemset(0,1)
print pi;

symbols = ['A', 'C', 'G', 'T']
def mapsymbol(symbol):
       try:
              return symbols.index(symbol)
       except:
              print symbol
              raise
       

p = numpy.arange(4*16).reshape(4,16)  #prob. of emmiting symbol d (ACGT) in state k

for e in p.flat:
    p.itemset(e,0)

p[0,0] = 1
p[1,0] = 1
p[2,0] = 1
p[3,0] = 1

p[0,1] = 1

p[2,2] = 1

p[3,3] = 1

p[3,4] = 1

p[2,5] = 1

p[0,6] = 1
p[1,6] = 1
p[2,6] = 1
p[3,6] = 1

p[0,7] = 1
p[1,7] = 1
p[2,7] = 1
p[3,7] = 1

p[0,8] = 1
p[1,8] = 1
p[2,8] = 1
p[3,8] = 1

p[3,9] = 1

p[0,10] = 1

p[2,11] = 1

p[0,12] = 1

p[2,13] = 1

p[0,14] = 1

p[0,15] = 1

print p;


